﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SyncList.Business.ValueObject;
using SyncList.Business;

namespace SyncList.Compare
{
    /// <summary>
    /// Logique d'interaction pour Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {

        /// <summary>
        /// Liste de tous les utilisateurs
        /// </summary>
        private FullCollection _full = new FullCollection();

        /// <summary>
        /// Collection complète des données fusionnées
        /// </summary>
        private FileFusionCollection _fusion = new FileFusionCollection();


        /// <summary>
        /// Constructeur
        /// </summary>
        public Window1()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(Window1_Loaded);
        }


        /// <summary>
        /// Liste de tous les utilisateurs
        /// </summary>
        public FullCollection Full
        {
            get { return (_full); }
        }



        /// <summary>
        /// Test en dur
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void Window1_Loaded(object sender, RoutedEventArgs e)
        {

            {
                string fileName = @"A:\DEV\SyncList\Lists\Emmanuel\Films.xml";
                Full.Add(new SingleUser("Emmanuel", fileName, ServiceAccessor.ImportService.ImportXml(fileName)));
            }

            {
                string fileName = @"A:\DEV\SyncList\Lists\Gregory\Films.xml";
                Full.Add(new SingleUser("Grégory", fileName, ServiceAccessor.ImportService.ImportXml(fileName)));
            }

            Full.CurrentUserName = "Emmanuel";

            _fusion = ServiceAccessor.FusionService.ComputeFusion(Full);

            FileFusion[] user1NewFiles = _fusion.ExtractExclusiveFiles("Emmanuel");

            FileFusion[] user2NewFiles = _fusion.ExtractExclusiveFiles("Grégory");

        }




    }
}
